/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"CECFC884-4976-4388-AAD3-9C8FA515D332",variableType:8}
 */
var fIva_1 = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"3D9A7D66-B530-4806-B266-F83FDCD5A2C2",variableType:8}
 */
var fIva_2 = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"CBE4330A-2F19-41EF-A7E8-40594A370DD5",variableType:8}
 */
var fIva_3 = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"DFF2CECD-A7D3-4BD2-8589-93BADDAF1BA1",variableType:8}
 */
var fIva_4 = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"533B9157-A345-46F1-A3B3-A863DD3F98F8",variableType:8}
 */
var fNeto_1 = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"16C4EA4E-3ECB-4ECF-A079-8757BDC0A191",variableType:8}
 */
var fNeto_2 = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"4CB45F02-F6FD-4928-9534-5BB44418B031",variableType:8}
 */
var fNeto_3 = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"EEBC3591-F232-4E7A-9D00-1A124FC1AFF9",variableType:8}
 */
var fNeto_4 = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"92AD2B4D-5C24-4083-A654-1336E4821777",variableType:8}
 */
var porc_1 = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"DCEFD21D-CD02-4FAE-A354-2007E246B4AA",variableType:8}
 */
var porc_2 = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"82B616A0-F0CB-4AB8-8ABF-938E461C8FB3",variableType:8}
 */
var porc_3 = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"7062CFBE-E61D-46AA-A36D-02F6508D5CFF",variableType:8}
 */
var porc_4 = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"5565D2D3-5B76-4562-A28B-202D37385235",variableType:8}
 */
var T_importe = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"9F86F784-C069-4A2B-81E0-1865FBB9E053",variableType:8}
 */
var T_iva = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"719097E4-3A07-493A-A662-C3A6669B328F",variableType:8}
 */
var T_neto = null;

/**
 *
 * @properties={typeid:24,uuid:"6710FE6E-7F16-46D2-9146-E42E4A201113"}
 */
function calcular_totales()
{
	application.output('calcular totales')
	// arma dataset
	//**//var tabla_totales = databaseManager.createEmptyDataSet(50,3)   habilitar cuando funcione
	var tabla_totales = databaseManager.createEmptyDataSet(10,3)
	
	//**//for ( var k = 0 ; k < 50 ; k ++ )
	for ( var k = 0 ; k < 10 ; k ++ )
	{
	tabla_totales.setValue(k, 1, 0.00);
	tabla_totales.setValue(k, 2, 0.00);
	tabla_totales.setValue(k, 3, 0.00);	
	}
	
	// recorre foundset
	T_neto=0
	T_iva=0
	T_importe=0
	for ( var i = 1 ; i <= controller.getMaxRecordIndex(); i++ )
	{
	foundset.setSelectedIndex(i)
	
	//  usando calculations
	T_neto+=neto_signo
	T_iva+=iva_signo
	T_importe+=importe_signo
	
	var k=ctacte_cl_to_tasa_iva_porc.tasa_iva_id
		
	tabla_totales.setValue(k, 1, iva_porc)
	tabla_totales.setValue(k, 2, tabla_totales.getValue(k, 2) + iva_signo)
	tabla_totales.setValue(k, 3, tabla_totales.getValue(k, 3) + neto_signo)
	}
	
	for ( var k = 1 ; k <= 10 ; k ++ )
	{
	if (tabla_totales.getValue(k, 1) != 0 && tabla_totales.getValue(k, 2) != 0 && tabla_totales.getValue(k, 3) != 0)		
	{
		application.output(k)
		application.output('porcentaje')
		application.output(tabla_totales.getValue(k, 1))
		application.output('iva')
		application.output(tabla_totales.getValue(k, 2))
		application.output('neto')
		application.output(tabla_totales.getValue(k, 3))
	}
	else
	{
		application.output('son todos ceros')
	fIva_1=tabla_totales.getValue(1, 2)
	fIva_2=tabla_totales.getValue(2, 2)
	fIva_3=tabla_totales.getValue(3, 2)
	fIva_4=tabla_totales.getValue(4, 2)
	porc_1=tabla_totales.getValue(1, 1)
	porc_2=tabla_totales.getValue(2, 1)
	porc_3=tabla_totales.getValue(3, 1)
	porc_4=tabla_totales.getValue(4, 1)
	fNeto_1=tabla_totales.getValue(1, 3)
	fNeto_2=tabla_totales.getValue(2, 3)
	fNeto_3=tabla_totales.getValue(3, 3)
	fNeto_4=tabla_totales.getValue(4, 3)
	}
	}               
}
